package org.minidao.myminidao.datasource;

/**
 * 
 * @author csxx_wmw
 *
 */
public class DataSourceContextHolder {
	//线程本地环境
	private static final ThreadLocal<DataSourceType> contextHolder = new ThreadLocal<DataSourceType>();
	
	//切换数据源
	public static void setDataSourceType(DataSourceType dataSourceType) {
		contextHolder.set(dataSourceType);
	}
	
	//获取当前数据源
	public static DataSourceType getDataSourceType() {
		return (DataSourceType) contextHolder.get();
	}

	//清除当前数据源
	public static void clearDataSourceType() {
		contextHolder.remove();
	}

}
